{extend name="layout/base"}
{block name="main"}

<!--</div>-->
<div class="right-main">
    <div class="mdui-card border-1 mdui-shadow-0 mdui-m-b-2 ">
        <div class="mdui-card-primary">
            <h3>网站设置</h3>
        </div>
        <div class="mdui-divider "></div>
        <div class="mdui-card-content">
            <form action="" class="layui-form ">
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">网站名称</div>
                    <input value="{$web.name}" name="name" class="mdui-textfield-input" type="text"/>
                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">网站标题</div>
                    <input value="{$web.title}" name="title" class="mdui-textfield-input" type="text">
                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">关键词</div>
                    <input value="{$web.keyword}" name="keyword" class="mdui-textfield-input" type="text">
                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">网站描述</div>
                    <textarea class="mdui-textfield-input" rows="4" placeholder="请输入网站描述">{$web.desc}</textarea>

                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">版版所有</div>
                    <input value="{$web.copyright}" name="copyright" class="mdui-textfield-input" type="text">
                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">备案号</div>
                    <input value="{$web.beian}" name="beian" class="mdui-textfield-input" type="text">
                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label">关站描述</div>
                    <textarea name="message" class="mdui-textfield-input" rows="4"
                              placeholder="请输入关站描述">{$web.message}</textarea>

                </div>


                <div class="mdui-textfield mdui-p-l-2">
                    <div class="mdui-textfield-label mdui-m-b-1">是否关闭网站</div>
                    <input type="checkbox" {if $web.state eq 1} checked {/if} value="1" name="state" lay-text="是|否"
                    lay-skin="switch">
                </div>
                <div class="mdui-textfield mdui-p-l-2">
                    <button class="mdui-btn border-1" lay-submit lay-filter="submit">提交</button>
                </div>
            </form>
        </div>

    </div>
</div>

{/block}
{block name="script"}
<script>
    layui.use(['form'], () => {
        var form = layui.form;
        form.on('submit(submit)', data => {
            $.post('/admin/web/update', data.field, res => {
                if (res.code === 1)
                    layer.msg(res.msg, {icon: 6, time: 2000}, () => {
                        // location.reload()
                    })
                else
                    layer.msg(res.msg, {icon: 5, time: 1500})
            })
            return false
        })
    })
</script>

{/block}